package day5;

public class Demo8 {

    static class Vehicle{
        private String name;

        private int speed;

        public void setOut(){}

    }

    static class Car extends Vehicle{
        private String name;

        private int speed;

        public Car(String name, int speed) {
            this.name = name;
            this.speed = speed;
        }

        @Override
        public void setOut() {
            System.out.println("每分钟" + this.speed + "米");
        }
    }

    static class Bicycle extends Vehicle{
        private String name;

        private int speed;

        public Bicycle(String name, int speed) {
            this.name = name;
            this.speed = speed;
        }

        @Override
        public void setOut() {
            System.out.println("每小时" + this.speed + "米");
        }
    }

    public static void main(String[] args) {
        Car car = new Car("小汽车", 1000);
        car.setOut();
        Bicycle bicycle = new Bicycle("自行车", 400);
        bicycle.setOut();
    }
}
